package sk.octopuss.archery.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import sk.octopuss.archery.domain.Category;
import sk.octopuss.archery.service.CategoryService;

@RequestMapping("/categories")
@Controller
public class CategoryController extends AbstractController{
	@Autowired
	private CategoryService categoryService;
	
	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public String show(@PathVariable("id") final Long id, final Model uiModel) {
		final Category c = categoryService.find(id);
		 uiModel.addAttribute(c);
        return "categories/show";
    }
}
